//package com.company.common.function.e_mail;
//
//import com.sun.mail.util.MailSSLSocketFactory;
//import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
//
//import javax.mail.Address;
//import javax.mail.Session;
//import javax.mail.Transport;
//import javax.mail.internet.InternetAddress;
//import javax.mail.internet.MimeMessage;
//import java.security.GeneralSecurityException;
//import java.util.Date;
//import java.util.Properties;
//
//public class MailTool {
//    public static void main(String[] args) throws GeneralSecurityException, MessagingException {
//        Properties properties = new Properties();
//
//        // 开启debug调试
//        properties.setProperty("mail.debug", "true");
//        // 发送服务器需要身份验证
//        properties.setProperty("mail.smtp.auth", "true");
//        // 设置邮件服务器主机名
//        properties.setProperty("mail.host", "smtp.qq.com");
//        // 发送邮件协议名称
//        properties.setProperty("mail.transport.protocol", "smtp");
//
//
//        MailSSLSocketFactory sf = new MailSSLSocketFactory();
//        sf.setTrustAllHosts(true);
//        properties.put("mail.smtp.ssl.enable", "true");
//        properties.put("mail.smtp.ssl.socketFactory", sf);
//
//        Session session = Session.getInstance(properties);
//
//        //邮件内容部分
//        MimeMessage msg = new MimeMessage(session);
//        msg.setSubject("seenews 错误");
//        StringBuilder builder = new StringBuilder();
//        builder.append("url = " + "http://blog.csdn.net/never_cxb/article/details/50524571");
//        builder.append("\n页面爬虫错误");
//        builder.append("\n时间 " + new Date());
//        msg.setText(builder.toString());
//
//        //邮件发送者
//        msg.setFrom(new InternetAddress("1972551648@qq.com"));
//        //发送邮件
//        Transport transport = session.getTransport();
//        transport.connect("smtp.qq.com", "1972551648@qq.com", "etdebmicoofgdfbj");
//
//        transport.sendMessage(msg, new Address[] { new InternetAddress("2625665838@qq.com") });
//        transport.close();
//
//
//    }
//}
